<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>星空背景导航栏</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            min-height: 100vh;
            background: #000;
            overflow: hidden;
        }

        /* 星空背景 */
        .stars {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
        }

        .star {
            position: absolute;
            width: 2px;
            height: 2px;
            background: #fff;
            border-radius: 50%;
            animation: twinkle 1s infinite;
        }

        @keyframes twinkle {

            0%,
            100% {
                opacity: 1;
            }

            50% {
                opacity: 0.3;
            }
        }

        /* 底部导航栏 */
        .nav-bar {
            position: fixed;
            bottom: 0;
            width: 100%;
            height: 80px;
            /* 增加高度 */
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }

        .nav-item {
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 10px;
            cursor: pointer;
            transition: all 0.3s;
        }

        .nav-item svg {
            width: 24px;
            height: 24px;
            stroke: #fff;
            stroke-width: 2;
            fill: none;
            transition: all 0.3s;
            filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.5));
        }

        .nav-item span {
            color: #fff;
            font-size: 12px;
            margin-top: 5px;
            opacity: 0.7;
            transition: all 0.3s;
        }

        .nav-item.active {
            transform: translateY(-15px);
        }

        .nav-item.active svg {
            stroke-dasharray: 100;
            stroke-dashoffset: 100;
            animation: draw 1s forwards;
            transform: scale(1.2);
            filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.8));
        }

        .nav-item.active span {
            opacity: 1;
            transform: scale(1.1);
            text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
        }

        .nav-item::after {
            content: '';
            position: absolute;
            bottom: -10px;
            width: 40px;
            height: 4px;
            background: #fff;
            border-radius: 2px;
            opacity: 0;
            transform: translateY(5px);
            transition: all 0.3s;
        }

        .nav-item.active::after {
            opacity: 1;
            transform: translateY(0);
        }

        @keyframes draw {
            to {
                stroke-dashoffset: 0;
            }
        }
    </style>
</head>

<body>
    <div class="stars"></div>

    <nav class="nav-bar">
        <div class="nav-item active">
            <svg viewBox="0 0 24 24">
                <path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
            </svg>
            <span>首页</span>
        </div>
        <div class="nav-item">
            <svg viewBox="0 0 24 24">
                <circle cx="12" cy="12" r="10"></circle>
                <path d="M12 16v-4M12 8h.01"></path>
            </svg>
            <span>发现</span>
        </div>
        <div class="nav-item">
            <svg viewBox="0 0 24 24">
                <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
                <circle cx="12" cy="7" r="4"></circle>
            </svg>
            <span>我的</span>
        </div>
    </nav>

    <script>
        // 生成星星
        function createStars() {
            const stars = document.querySelector('.stars');
            const count = 200;

            for (let i = 0; i < count; i++) {
                const star = document.createElement('div');
                star.className = 'star';
                star.style.left = `${Math.random() * 100}%`;
                star.style.top = `${Math.random() * 100}%`;
                star.style.animationDelay = `${Math.random() * 1}s`;
                stars.appendChild(star);
            }
        }

        // 导航栏点击效果
        function initNavBar() {
            const items = document.querySelectorAll('.nav-item');

            items.forEach(item => {
                item.addEventListener('click', () => {
                    items.forEach(i => i.classList.remove('active'));
                    item.classList.add('active');
                });
            });
        }

        createStars();
        initNavBar();
    </script>
</body>

</html>